##############################################################################
# CMake
##############################################################################

cmake_minimum_required(VERSION 2.8)
project(testCuda)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-std=c++11 -pthread")

add_definitions(-DMAVLINK_SEND_UART_BYTES=mavlink_send_uart_bytes)
# find_package(OpenCV REQUIRED)

find_package(CUDA REQUIRED)
find_package(OpenCV REQUIRED)
find_package(catkin REQUIRED
    COMPONENTS
    roscpp
    move
)

# qt 
find_package(Qt5Widgets REQUIRED)
find_package(Qt5SerialPort REQUIRED)


catkin_package(
    CATKIN_DEPENDS
    roscpp
)
# catkin_package(
# )

file(GLOB_RECURSE SOURCE_FILES src/*.cpp)
file(GLOB_RECURSE CU_FILES src/*.cu)

include_directories(
  ${CMAKE_CURRENT_SOURCE_DIR}/include
  ${CMAKE_CURRENT_SOURCE_DIR}
  ${catkin_INCLUDE_DIRS}
  ${CATKIN_DEVEL_PREFIX}/include

  include/mavlink/include/mavlink/v1.0
  include/mavlink/include/mavlink/v1.0/common
  # ${OpenCV_INCLUDE_DIRS}
)


cuda_add_executable(${PROJECT_NAME}
	${SOURCE_FILES}
	${CU_FILES}
) 

target_link_libraries(${PROJECT_NAME}
	${catkin_LIBRARIES}
	${OpenCV_LIBS}

# qt
Qt5::Widgets
Qt5::SerialPort
)


add_dependencies(${PROJECT_NAME} move_generate_messages_cpp)

# foreach(CU ${CU_FILES})
#     get_filename_component(prjName ${CU} NAME_WE)

#     cuda_add_executable(${prjName}
#           ${CU}
#     ) 
# endforeach()



# cuda_add_executable(${PROJECT_NAME}
#   ${SOURCE_FILES}
# ) 
